package org.jetnuke.modules.admin.blocks;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.velocity.VelocityContext;
import org.jetnuke.common.ActionForward;
import org.jetnuke.common.IAction;
import org.jetnuke.common.IAdminInfo;
import org.jetnuke.common.IModuleInfo;
import org.jetnuke.common.IUserInfo;
import org.jetnuke.dao.DataAccessDriver;
import org.jetnuke.dao.HeadLinesDAO;
import org.jetnuke.entities.HeadLine;
import org.jetnuke.util.JetUtil;

public class UpdateRssSetup implements IAction {
int id;
String title,url;
public void setId(int id) {
	this.id = id;
}
public void setTitle(String title) {
	this.title = title;
}
public void setUrl(String url) {
	this.url = url;
}
	/* (non-Javadoc)
	 * @see org.jetnuke.common.IAction#exec(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.apache.velocity.VelocityContext, org.jetnuke.common.IModuleInfo, java.lang.String, org.jetnuke.common.IUserInfo, org.jetnuke.common.IAdminInfo)
	 */
	public ActionForward exec(HttpServletRequest request,
			HttpServletResponse response, VelocityContext vc, IModuleInfo info,
			String op, IUserInfo ui, IAdminInfo ai) throws Exception {
		HeadLinesDAO hm=DataAccessDriver.getInst().newHeadLinesDAO();
		HeadLine hl=hm.retrieveByPK(id);
		hl.setSITENAME(title);
		hl.setHEADLINESURL(url);
		hm.update(hl);
		JetUtil.redirect(vc,response,request.getContextPath()+"/do/admin/setup_rss");
		return null;
	}

}
